<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>experimental::make_parallel_group</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../boost_asio.html" title="Boost.Asio">
<link rel="up" href="../reference.html" title="Reference">
<link rel="prev" href="experimental__is_promise_v.html" title="experimental::is_promise_v">
<link rel="next" href="experimental__operator_pipe_.html" title="experimental::operator|">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="experimental__is_promise_v.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="experimental__operator_pipe_.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="boost_asio.reference.experimental__make_parallel_group"></a><a class="link" href="experimental__make_parallel_group.html" title="experimental::make_parallel_group">experimental::make_parallel_group</a>
</h3></div></div></div>
<p>
        <a class="indexterm" name="boost_asio.indexterm.experimental__make_parallel_group"></a> 
Create
        a group of operations that may be launched in parallel.
      </p>
<pre class="programlisting">template&lt;
    typename... Ops&gt;
parallel_group&lt; Ops...&gt; make_parallel_group(
    Ops... ops);
</pre>
<p>
        For example:
      </p>
<pre class="programlisting">boost::asio::experimental::make_parallel_group(
   [&amp;](auto token)
   {
     return in.async_read_some(boost::asio::buffer(data), token);
   },
   [&amp;](auto token)
   {
     return timer.async_wait(token);
   }
 ).async_wait(
   boost::asio::experimental::wait_for_all(),
   [](
       std::array&lt;std::size_t, 2&gt; completion_order,
       boost::system::error_code ec1, std::size_t n1,
       boost::system::error_code ec2
   )
   {
     switch (completion_order[0])
     {
     case 0:
       {
         std::cout &lt;&lt; "descriptor finished: " &lt;&lt; ec1 &lt;&lt; ", " &lt;&lt; n1 &lt;&lt; "\n";
       }
       break;
     case 1:
       {
         std::cout &lt;&lt; "timer finished: " &lt;&lt; ec2 &lt;&lt; "\n";
       }
       break;
     }
   }
 );
</pre>
<h5>
<a name="boost_asio.reference.experimental__make_parallel_group.h0"></a>
        <span class="phrase"><a name="boost_asio.reference.experimental__make_parallel_group.requirements"></a></span><a class="link" href="experimental__make_parallel_group.html#boost_asio.reference.experimental__make_parallel_group.requirements">Requirements</a>
      </h5>
<p>
        <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/experimental/parallel_group.hpp</code>
      </p>
<p>
        <span class="emphasis"><em>Convenience header: </em></span>None
      </p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003-2021 Christopher
      M. Kohlhoff<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="experimental__is_promise_v.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="experimental__operator_pipe_.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
